package net.peelmeagrape.hibernate.collections;

import net.peelmeagrape.hibernate.xmlgen.*;
import net.peelmeagrape.hibernate.Meta;

import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Map collection element with value semantics, similar to a {@link net.peelmeagrape.hibernate.Component}
 * mapping. 
 */
@Retention(RUNTIME)
@XmlElement(name="composite-element",
        reorderChildren="meta*,parent?,(property|many-to-one|any|nested-composite-element")
public @interface CompositeElement
{
    @XmlAttribute("class")
    @DefaultFromGenericType(-1)
    @ProcessTargetClass()
            Class[] targetClass() default {};

    @XmlAttribute String node() default "";

    @ChildElement(0) Meta[] meta() default {};
}
